import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import type { App } from 'vue'
import mainLayout from '../views/mainLayout.vue'


const routes:RouteRecordRaw[]  = [
    { path: '/', redirect: "/home" },
    { 
        path: '/home',
        name: 'home',
        component: mainLayout,
        children: [
            {
                path:'',
                name: 'home_index',
                component: () => import("/@/views/home/index.vue")
            }
        ]
    },
    {
        path: '/reader/pdf',
        name: 'reader_pdf',
        component: () => import("/@/views/reader/pdf.vue")
    },
    {
        path: '/reader/epub',
        name: 'reader_epub',
        component: () => import("/@/views/reader/epub.vue")
    },    
    {
        path: '/reader/md',
        name: 'reader_markdown',
        component: () => import("/@/views/reader/markdown.vue")
    },
    {
        path: '/pdf',
        name: 'name',
        component: () => import("/@/components/PdfViewer.vue")
    },
    {
        path:'/demos/index',
        name: 'demos_index',
        component: () => import("/@/views/demos/index.vue")
    },
    {
        path:'/demos/icons',
        name: 'demos_icons',
        component: () => import("/@/views/demos/icons.vue")
    },
    {
        path:'/demos/hbw',
        name: 'demos_hbw',
        component: () => import("/@/views/demos/hbw.vue")
    }
]
const router = createRouter({
    history: createWebHashHistory(),
    routes
})


export function setupRouter(app: App<Element>) {
    app.use(router)
}